Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> import matplotlib.pyplot as plt
>>> import seaborn as sns
>>>
>>> # Load your Excel file
>>> file_path = r'C:\Users\SBD Lab\Desktop\BE_2024_daily.xlsx'
>>> df = pd.read_excel(file_path)
>>> df.columns = ['Datetime', 'Country', 'Carbon_intensity']
>>> df['Datetime'] = pd.to_datetime(df['Datetime'])
>>>
>>> # Add DayOfYear and Month
>>> df['DayOfYear'] = df['Datetime'].dt.dayofyear
>>> df['Month'] = df['Datetime'].dt.strftime('%b')
>>>
>>> # Create the figure and heatmap
>>> fig, ax = plt.subplots(figsize=(14, 2.8))  # Adjust height for clean layout
>>> heatmap = sns.heatmap(
...     [df['Carbon_intensity'].values],
...     cmap='RdYlGn_r',
...     cbar=True,
...     cbar_kws={
...         'orientation': 'horizontal',
...         'label': 'Carbon Intensity [gCO₂/kWh]',
...         'pad': 0.15  # Slightly closer to heatmap
...     },
...     vmin=0,
...     vmax=300,
...     ax=ax
... )
>>>
>>> # Set X-axis labels (months)
>>> month_names = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
...                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
>>> tick_positions = [15, 45, 74, 105, 135, 165, 195, 225, 255, 285, 315, 345]
>>> ax.set_xticks(tick_positions)
[<matplotlib.axis.XTick object at 0x000002CE3AB94820>, <matplotlib.axis.XTick object at 0x000002CE3CB42230>, <matplotlib.axis.XTick object at 0x000002CE3CB42EF0>, <matplotlib.axis.XTick object at 0x000002CE3CB43BE0>, <matplotlib.axis.XTick object at 0x000002CE3CB42A10>, <matplotlib.axis.XTick object at 0x000002CE3CB78F70>, <matplotlib.axis.XTick object at 0x000002CE3CB79C60>, <matplotlib.axis.XTick object at 0x000002CE3CB7A950>, <matplotlib.axis.XTick object at 0x000002CE3CB7A200>, <matplotlib.axis.XTick object at 0x000002CE3CB7B9A0>, <matplotlib.axis.XTick object at 0x000002CE3CB986D0>, <matplotlib.axis.XTick object at 0x000002CE3CB993C0>]
>>> ax.set_xticklabels(month_names, rotation=0, fontsize=14)
[Text(15, 0, 'Jan'), Text(45, 0, 'Feb'), Text(74, 0, 'Mar'), Text(105, 0, 'Apr'), Text(135, 0, 'May'), Text(165, 0, 'Jun'), Text(195, 0, 'Jul'), Text(225, 0, 'Aug'), Text(255, 0, 'Sep'), Text(285, 0, 'Oct'), Text(315, 0, 'Nov'), Text(345, 0, 'Dec')]
>>>
>>> # Remove y-axis labels
>>> ax.set_yticks([])
[]
>>>
>>> # Set x-axis label just a little closer
>>> ax.set_xlabel("Day (2024)", fontsize=13, labelpad=8)
Text(0.5, 66.20222222222223, 'Day (2024)')
>>>
>>> # Set bold title
>>> plt.title('Daily Carbon Intensity (Belgium 2024)', fontsize=18, fontweight='bold')
Text(0.5, 1.0, 'Daily Carbon Intensity (Belgium 2024)')
>>>
>>> plt.tight_layout()
>>> plt.show()

